Skip to content

GH-4468: Fix no-op ack detection for non-null Acknowledgment#4470

Open
abhimoondra wants to merge 1 commit into
spring-projects:mainfrom
abhimoondra:GH-4468
Open

GH-4468: Fix no-op ack detection for non-null Acknowledgment#4470
abhimoondra wants to merge 1 commit into
spring-projects:mainfrom
abhimoondra:GH-4468

Conversation

@abhimoondra
Copy link
Copy Markdown

Fixes #4468.

The built-in DLT logging handler LoggingDltListenerHandlerMethod.logMessage(Object, @NonNull Acknowledgment) stopped working under a non-manual ack mode on 4.0. Its @NonNull is now the JSpecify @NonNull (a TYPE_USE annotation), which MethodParameter.getParameterAnnotation() doesn't return, so noOpAck stayed false and the DLT consumer failed with No Acknowledgment available ... MANUAL AckMode and re-published the record to the same DLT in a loop.

Switched the check in MessagingMessageListenerAdapter.determineInferredType to Nullness.forMethodParameter() (per the suggestion on the issue), which understands TYPE_USE and @NullMarked nullness.

Also added a test covering the non-null Acknowledgment parameter case, which wasn't covered before.

…dgment

The built-in DLT logging handler declares its Acknowledgment parameter
with the JSpecify @nonnull, which is a TYPE_USE annotation that
MethodParameter.getParameterAnnotation() does not see. So noOpAck stayed
false and, under a non-manual ack mode, DLT consumption failed with
"No Acknowledgment available ... MANUAL AckMode".

Use Nullness.forMethodParameter() instead, which understands TYPE_USE
and @NullMarked nullness. Add a test for the non-null case.

Signed-off-by: Abhishek Moondra <abhishek.moondra@sixt.com>
Copy link
Copy Markdown
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Please, add your name to the @author list of all the affected classes.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@RetryableTopic: built-in DLT logging handler fails with "No Acknowledgment available" on 4.0 (works on 3.3.x)

2 participants